package main

import (
	"fmt"
	"os"
	"reflect"
)

func main() {
	type user struct {
		name string
		age  int
	}

	u := user{"Tom", 20}
	fmt.Println(u)
	u1 := struct {
		name string
		age  int
	}{
		"张是哪",
		20,
	}

	fmt.Println(u1)

	exit := make(chan struct{})

	go func() {
		fmt.Println("hello")
		exit <- struct{}{}
	}()
	<-exit
	fmt.Println("end")
	type data struct {
		os.File
		*int
		string
	}
	a := 100
	b := "abc"
	f := data{
		File:   os.File{},
		int:    &a,
		string: b,
	}

	fmt.Printf("%#v\n", f)

	type person struct {
		name string "姓名"
		age  int    "年龄"
	}

	p := person{
		"Tom", 1,
	}

	v := reflect.ValueOf(p)
	t := v.Type()
	for i, n := 0, t.NumField(); i < n; i++ {
		fmt.Printf("%s:%v\n", t.Field(i).Tag, v.Field(i))
	}

}
